//
//  main.c
//  Acos
//
//  Created by 鸿妈 on 14-4-22.
//  Copyright (c) 2014年 Naomi. All rights reserved.
//

#include <stdio.h>
#include <math.h>
void abcos();
void lineAndCos();
int main(int argc, const char * argv[])
{

//    abcos;
    abcos();
    printf("\n");
    lineAndCos();
    
//    Program ended with exit code: 0
    return 0;
}
//打印0-360的cos曲线
void abcos()
{
    double y;
    int x,m;
    for (y = 1; y >= -1 ; y -= 0.1) {
        m = acos(y) * 10;
        for (x = 1; x < m; x++) {
            printf(" ");
        }
        printf("*");
        for (; x < 62-m; x++) {
            printf(" ");
        }
        printf("*\n");
    }
    
}
//打印一条直线和一条cos曲线
void lineAndCos()
{
    double y;
    
    int x,m,n,yy;
    
    for (yy =0; yy <= 20; yy++) {
        y = 0.1 * yy;
        m = acos(1 - y) * 10;
        n = 45 * (y - 1) + 31;
        for (x = 0; x <= 62; x++) {
            if (x == m && x == n) {
                printf("+");
            }
            else if (x == n)
            {
                printf("+");
            }
            else if (x == m || x == 62 - m)
            {
                printf("*");
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
        
    }
 
}
